/* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Mario Orsi
   This file is part of Brahms.
   Brahms is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   Brahms is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
   You should have received a copy of the GNU General Public License along with Brahms.  If not, see <http://www.gnu.org/licenses/>. */

#include "definitions.h"

typedef enum { PM = 0,  /* Point Mass (3 translational degrees of freedom) */  
	       SRB = 1, /* Symmetric Rigid Body (3 translational + 2 rotational degrees of freedom) */
	       NSRB = 3 /* Non-Symmetric Rigid Body (3 translational + 3 rotational degrees of freedom) */
} MechType; /* mechanical type of a site */

typedef enum { WATER=0,
	       CHOLINE_OR_AMINE=1, // for convenience, lipidUnit 1 represents CHOLINE in DOPC and AMINE in DOPE
	       PHOSPHATE=2,
	       GLYCEROL=3, 
	       ESTER_A=4, 
	       TAIL_A1=5, 
	       TAIL_A2=6, 
	       TAIL_A3=7, 
	       TAIL_A4=8, 
	       TAIL_A5=9, 
	       ESTER_B=10, 
	       TAIL_B1=11, 
	       TAIL_B2=12, 
	       TAIL_B3=13, 
	       TAIL_B4=14, 
	       TAIL_B5=15, 
	       SOLUTE = 999
} LipidUnit;  /* lipid unit - see below for an explanatory sketch */

typedef enum { WATER_TYPE = 0, 
	       CHOLINE_TYPE = 1, 
	       PHOSPHATE_TYPE = 2, 
	       GLYCEROL_TYPE = 3, 
	       ESTER_TYPE = 4, 
	       TAIL_TYPE = 5, 
	       AMINE_TYPE = 6, 
	       SOLUTE_TYPE = 7, 
} SiteType; 

typedef enum { WAT_WAT = 0,        
	       NEUTRAL = 1, 
	       CHG_CHG = 2, 
	       CHG_DIP = 3,
	       DIP_CHG = 4, 
	       DIP_DIP = 5 
} InteractionType; // type of nonbonded pair interaction

typedef enum { NON_LIPID = 0, 
	       DOPC = 1, // for convenience, this also represents DSPC for now
	       DOPE = 2 
} LipidSpecies; /* lipid species */

typedef enum { OO = 0, 
	       OH = 1, 
	       HH = 2 
} WaterAtom; /* for water rdf computation - better placed in the rdf.c module? */

// DOPC (lipidUnit, SiteType): 
//      CHOLINE   (1,1)
//        |
//      PHOSPHATE (2,2)
//        |
//      GLYCEROL  (3,3)
//     |        |
//ESTER_A (4,4) ESTER_B (10,4)
//    |              |
//TAIL_A1 (5,5) TAIL_B1 (11,5)
//    |              |
//TAIL_A2 (6,5) TAIL_B2 (12,5)
//    |              |
//TAIL_A3 (7,5) TAIL_B3 (13,5)
//    |              |
//TAIL_A4 (8,5) TAIL_B4 (14,5)
//    |              |
//TAIL_A5 (9,5) TAIL_B5 (15,5)

// DOPE (lipidUnit, SiteType): same as DOPC apart from the AMINE substituting the CHOLINE site 
//      AMINE     (1,6)
//        |
//      PHOSPHATE (2,2)
//        |
//      GLYCEROL  (3,3)
//     |        |
//ESTER_A (4,4) ESTER_B (10,4)
//    |              |
//TAIL_A1 (5,5) TAIL_B1 (11,5)
//    |              |
//TAIL_A2 (6,5) TAIL_B2 (12,5)
//    |              |
//TAIL_A3 (7,5) TAIL_B3 (13,5)
//    |              |
//TAIL_A4 (8,5) TAIL_B4 (14,5)
//    |              |
//TAIL_A5 (9,5) TAIL_B5 (15,5)

/* Data structure "Site" contains constant charateristics */
typedef struct {
  SiteType type; /* site type - see corresponding typedef */
  MechType mechType; /* mechanical types - see corresponding typedef */
  int inLipid; // lipid identifier: -1 if site don't belong to any lipid (eg water), 1 if it belongs to lipid-1, N if it belongs to lipid-N...
  LipidSpecies lipidSpecies; // lipid species (e.g., DOPC) see corresponding typedef 
  LipidUnit lipidUnit; /* lipid unit (e.g., TAIL_A1) see corresponding typedef */
  LipidUnit skipNonbondedInteraction1; /* "first" unit excluded from nonbonded interaction with current unit */
  LipidUnit skipNonbondedInteraction2; /* "second" unit excluded from nonbonded interaction with current unit */
  LipidUnit skipNonbondedInteraction3; /* "third" unit excluded from nonbonded interaction with current unit */
} Site;

typedef struct {
  int nBeads;  
} LipidStruct;

/* Structure to contain infos for the atomistic solute in z-constrain calculations: */
typedef struct {   /* variables associated with each atom */
  char type[ 5 ]; // five elements: id (first four) + \0 (last)
  VecR f;  /* force  */
  real charge, /* atom charge */
    sig, /* LJ diameter sigma */
    eps; /* LJ energy epsilon */
} Atom;

// Structure for the characterisation of the orientation of the AL solute(s)
typedef struct {
  Prop p2x, p2y, p2z;
} OrdParSolute;

/* TBuf: structure associated with each set of diffusion measurement (diffusion buffer) [Rapaport, p.125,226] */
typedef struct {
  VecR *orgR;       /* origins for the set of measurements */
  VecR *orgD;       // origin values of the dipole orientations
  VecR *rTrue;      /* true displacement components (after removing  PBC effect) */
  real *ddDiffuse;  // squared dipole displacements
  real *rrDiffuse;  /* mean-square displacement accumulator */
  int count;        /* counter */
} TBuf;

/* latDiffBuff: structure associated with each set of lateral diffusion measurement (lateral diffusion buffer) */
typedef struct {
  VecRTwo *orgTwo,   /* origins for the set of measurements */
    *latDispTrueTwo; /* true displacement components (after removing  PBC effect) */
  real *latSqrDisp;  /* mean-square displacement accumulator */
  int count;         /* counter */
} LatDiffBuff;




